<%@page import="java.util.ArrayList" %>
<!DOCTYPE html>
<html>
<head>
<title>Second Home Inc.</title>
<link rel="stylesheet" href="jquery/jquery-ui-1.11.2.custom/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="jquery/jquery-1.11.1.js"></script>
<script type="text/javascript" src="jquery/jquery-ui-1.11.2.custom/jquery-ui.js"></script>
<script type="text/javascript" src="validateLogin.js"></script>
  
<script>
var dateToday = new Date();
	jQuery(document).ready(function($) {
		$("#startDatePicker").datepicker({
		    defaultDate: "+1w",
		    changeMonth: true,
		    numberOfMonths: 3,
		    minDate: dateToday,
		});
	
		$("#endDatePicker").datepicker({
		    defaultDate: "+1w",
		    changeMonth: true,
		    numberOfMonths: 3,
		    minDate: dateToday,
		});
		
        $("#numPeopleDropdown").selectmenu({
        	"width" : 60
        });
    });
</script>
</head>
<body>
  <div id="page-wrap" align="center">
  
    <!-- Navigation include -->
    <%@ include file="navigation.jsp" %>
    <!-- End Navigation include -->
    
    <br />
    <table class="main" title="Content" id="content">
    <%
      if (request.getSession().getAttribute("user") == null)
      {
        ArrayList<String> errors = (ArrayList<String>) request.getAttribute("errors");
        if (errors != null && errors.size() > 0)
        {
          out.write("<tr><td>");
          out.write("<div align=\"center\">");
          out.write("<table><tr><td>");

          for (String error : errors)
          {
            out.write("<div id=\"error\">" + error + "</div><br />");
          }
          out.write("</td></tr></table>");
          out.write("</div></td></tr>");
        }
        
        out.write("<tr><td>");
        out.write("    <table style=\"float:right;\">");
        out.write("      <tr>");
        out.write("        <td>");
        out.write("          <table>");
        out.write("          <form name=\"loginForm\" action=\"controller?&source=login\" onsubmit=\"return validateForm()\" method=POST>");
        out.write("            <tr>");
        out.write("              <td style=\"float:right;\">E-mail:<input type=\"TEXT\" name=\"login_email\"> <br /></td>");
        out.write("            </tr>");
        out.write("            <tr>");
        out.write("              <td style=\"float:right;\">Password:<input type=\"PASSWORD\" name=\"login_password\"> <br /></td>");
        out.write("            </tr>");
        out.write("            <tr>");
        out.write("              <td style=\"float: right; margin-right: 12px\"><input type=\"SUBMIT\" name=\"loginButton\" value=\"Log In\"></td>");
        out.write("            </tr>");
        out.write("          </form>");
        out.write("          </table>");
        out.write("        </td>");
        out.write("      </tr>");
        out.write("    </table>");
        out.write("</td></tr>");
      }
        
      String msg = (String) request.getAttribute("message");
      if (msg != null)
      {
        out.write("<tr><td>");
        out.write("<div id=\"message\" align=\"center\">");
        out.write(msg);
        out.write("</div>");
        out.write("</td></tr>");
      }
    %>
    
    <tr>
      <td>
			  <p>We'd love to host you at one of our many locations ranging from luxurious
           high rises to cozy boutiques. You'll find our wide variety of properties
           has something to please everyone.</p>
        <p>Start the search for your perfect getaway below! We look forward
           to having you visit!</p>
        
        <form action="controller" method="post">
            <table>
                <tr>
                    <td>Check-In Date: </td>
                    <td><input type="text" name="check-in" value="" id="startDatePicker" /></td>
                </tr>
                <tr>
                    <td>Check-Out Date: </td>
                    <td><input type="text" name="check-out" value="" id="endDatePicker" /></td>
                </tr>
                <tr>
                    <td style="vertical-align:middle;">Number of Guests: </td>
                    <td><select name="numPeople" id="numPeopleDropdown">
                            <option>1</option>
                            <option selected="selected">2</option>
                            <option>3</option>
                            <option>4</option>
                    </select></td>  
                </tr>
                <tr>
                  <td></td>
                  <td style="float: right;">
                    <input type="hidden" name="source" value="resSearch"/>
                    <input type="submit" name="searchAvailabilityButton" value="Search for Availability"/>
                  </td>
                </tr> 
            </table>

        </form>
      </td>
    </tr>  
    
    </table>
  </div>
</body>
</html>
